from app.exts import db
from app.models.po.base_po import BasePO


class GaoLuIntegrationPO(db.Model, BasePO):
    __tablename__ = "gaolu_integration"
    __bind_key__ = "serve_engine"
    id = db.Column(db.Integer, primary_key=True)
    create_time = db.Column(db.DateTime())
    date_time = db.Column(db.DateTime())
    score = db.Column(db.FLOAT())
    score_evaluation = db.Column(db.VARCHAR(100))
    trend_warning = db.Column(db.VARCHAR(100))
    status_warning = db.Column(db.VARCHAR(100))
    lose_points = db.Column(db.TEXT())
    stage_warning = db.Column(db.VARCHAR(100))


class GaoLuIntegrationOperation(db.Model, BasePO):
    __tablename__ = "gaolu_integration_operation"
    __bind_key__ = "serve_engine"
    id = db.Column(db.Integer, primary_key=True)
    key = db.Column(db.VARCHAR(64))
    name = db.Column(db.VARCHAR(64))
    status = db.Column(db.VARCHAR(32))
    scope = db.Column(db.VARCHAR(64))
    gaolu_integration_id = db.Column(db.Integer)


if __name__ == "__main__":
    from sqlalchemy import create_engine, Integer, String, Float
    from sqlalchemy.orm import sessionmaker
    from sqlalchemy.ext.declarative import declarative_base
    from sqlalchemy import Column

    engine = create_engine("mysql+pymysql://root:Luck158,@10.8.0.2:3306/hblg?charset=utf8")
    Session = sessionmaker(bind=engine)
    GaoLuIntegrationOperation.metadata.create_all(engine)
